package com.boot.proofing.common.config;/**
 * @description
 * @autor xbwu on 2018/12/3.
 */

import com.boot.core.common.util.SpringUtils;
import org.quartz.SchedulerException;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

/**
 *
 * @author xbwu
 * @create 2018-12-03 
 **/
@Component
public class ApplicationStartQuartzJobListener implements ApplicationListener<ContextRefreshedEvent> {


    /**
     * 初始启动quartz
     */
    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        try {
            SpringUtils.getBean(QuartzSchedulerCustomer.class).startJob();
            System.out.println("任务已经启动...");
        } catch (SchedulerException e) {
            e.printStackTrace();
        }
    }

}